package net.mysoft.budgetsoft.system.domain;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**   
 *  
 * @author dagongPGP v1.0 
 * @link <a href=http://www.dagongsoft.net>北京大公信软科技有限公司</a> 
 *  
 * @version $Revision: 1.00  $Date: 2013-12-27 08:45:08 
 */
//@Entity
//@Table(name="CaiDan")
public class TCaiDan implements java.io.Serializable {  
    private String bianHao;
    private String caiDanMC;
    private Integer caiDanDJ;
    private Integer shunXu;
    private String luJing;
    private Integer zhuangTai;
    private String beiZhu;
    private TCaiDan pCaiDan;
    private Set<TCaiDan> caiDans;

	@Id 
    @Column(name="BianHao", unique=true, nullable=false)
    public String getBianHao(){
    	return this.bianHao;
    }
    
    public void setBianHao(String bianHao){
    	this.bianHao = bianHao;
    }
    
    @Column(name="CaiDanMC")
    public String getCaiDanMC(){
    	return this.caiDanMC;
    }
    
    public void setCaiDanMC(String caiDanMC){
    	this.caiDanMC = caiDanMC;
    }
    
    @Column(name="CaiDanDJ")
    public Integer getCaiDanDJ(){
    	return this.caiDanDJ;
    }
    
    public void setCaiDanDJ(Integer caiDanDJ){
    	this.caiDanDJ = caiDanDJ;
    }
    
    @Column(name="ShunXu")
    public Integer getShunXu(){
    	return this.shunXu;
    }
    
    public void setShunXu(Integer shunXu){
    	this.shunXu = shunXu;
    }
    
    @Column(name="LuJing")
    public String getLuJing(){
    	return this.luJing;
    }
    
    public void setLuJing(String luJing){
    	this.luJing = luJing;
    }
    
    @Column(name="ZhuangTai")
    public Integer getZhuangTai(){
    	return this.zhuangTai;
    }
    
    public void setZhuangTai(Integer zhuangTai){
    	this.zhuangTai = zhuangTai;
    }
    
    @Column(name="BeiZhu")
    public String getBeiZhu(){
    	return this.beiZhu;
    }
    
    public void setBeiZhu(String beiZhu){
    	this.beiZhu = beiZhu;
    }
    
    
    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ShangJiCDBH")
    public TCaiDan getpCaiDan() {
		return pCaiDan;
	}

	public void setpCaiDan(TCaiDan pCaiDan) {
		this.pCaiDan = pCaiDan;
	}
    
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "pCaiDan")
	public Set<TCaiDan> getCaiDans() {
		return caiDans;
	}

	public void setCaiDans(Set<TCaiDan> caiDans) {
		this.caiDans = caiDans;
	}
	
	
	@Override
    public int hashCode() {
    	int prime = 0;
        prime +=this.getBianHao().hashCode();
        return prime;
    }

    @Override
    public boolean equals(Object obj) {
    	boolean isEquals = false;
    	if(obj!=null&&this.getClass()==obj.getClass()){
    		TCaiDan clazz = (TCaiDan)obj;
            if(clazz.getBianHao().equals(this.getBianHao()))
            	isEquals = true;
    		return isEquals;
    	}
        return isEquals;
    }

}